var param_name1 = 'A01_H09T12';
var inputdata = {"param_name": param_name1};
var real_time = "";
var fake_time = "";

$(document).ready(function () {
	s_title = localStorage.getItem('s_title');
    $("title").html("欢迎使用"+s_title);
    
	get_ajax_baseurl(inputdata, "A01_H09T12");	
	var a=setInterval(function(){
		get_ajax_baseurl(inputdata, "A01_H09T12");
	},60000);
	var b=setInterval(function(){
	      var box=$("#time");  
          var time=new Date(box.html()); 
		  time.setTime(time.getTime()+1000);
          var year=time.getFullYear();  //获取年份  
          var month=checkTime(time.getMonth()+1);  //获取月份  
          var day=checkTime(time.getDate());   //获取日期  
          var hour=checkTime(time.getHours());   //获取时  
          var minite=checkTime(time.getMinutes());  //获取分  
          var second=checkTime(time.getSeconds());  //获取秒  
          /****当时、分、秒、小于10时，则添加0****/  
          function checkTime(i){  
              if(i<10) return "0"+i;  
              return i;  
          }
		  if(fake_time == ""){
			fake_time = year+"-"+month+"-"+day+" "+hour+":"+minite+":"+second;
			$("#time").css("color","white");
		  }
		  if(new Date(fake_time)-new Date(real_time)>90000){
			$("#time").css("color","red");
		  }
		  else{
			fake_time = year+"-"+month+"-"+day+" "+hour+":"+minite+":"+second;
			$("#time").css("color","white");
		  }
          box.html(fake_time);         
	},1000);  
});

function A01_H09T12(input) {
    layer.close(ly_index);
	var a = input.A01_H09T12_TITLE;
	var b = input.A01_H09T12_DATA;
	var c = input.A01_H09T12_FLAG;
	if(b[0][GetLowUpp("get_time")] == real_time){
	}
	else{
		$("#div2_content").html("");
		var html = "";
		for(var i=0;i<Object.keys(a[0]).length;i++){
			if(Object.keys(a[0])[i].toString() != "get_time")
			{
				html = html + "<div class=\"form-group\">";
				var div_a = (a[0][Object.keys(a[0])[i]]!="")?(a[0][Object.keys(a[0])[i]]):("-");
				var div_b = (b[0][Object.keys(a[0])[i]]!="")?(b[0][Object.keys(a[0])[i]]):("-");
				var div_c = (c[0][Object.keys(a[0])[i]]!="")?(c[0][Object.keys(a[0])[i]]):("-");
				html = html + "<div class=\"col-sm-4\">"+div_a+"</div>";
				html = html + "<div class=\"col-sm-4\">"+div_b+"</div>";
				html = html + "<div class=\"col-sm-4\">"+div_c+"</div>";
				html = html + "</div>";
			}
		}	
		html = html + "<div class=\"form-group\">";
		html = html + "<div class=\"col-sm-4\">采集时间</div>";
		html = html + "<div class=\"col-sm-4\" id=\"time\">"+set_time_decode(b[0][GetLowUpp("get_time")])+"</div>";
		html = html + "<div class=\"col-sm-4\"></div>";
		html = html + "</div>";	
		$("#div2_content").append(html);
		real_time = set_time_decode(b[0][GetLowUpp("get_time")]);
	}
}